<template>
  <div class="pages">
    <div class="insp_box" style="border-top: 0.0625rem solid #e7ecf5">
      <div class="insp_box_nocell">
        <template v-if="(info.reportType == 0)">
          <span>报告类型：</span>普通检验报告
        </template>
        <template v-else><span>报告类型：</span>药敏检验报告</template>
      </div>
      <div class="insp_box_nocell">
        <span>检查项目：</span>{{ reportInfo.itemName }}
      </div>
      <div class="insp_box_cell">
        <div><span>就&nbsp;&nbsp;诊&nbsp;人：</span>{{ reportInfo.patientName }}</div>
        <div>
          <span>性别：</span>{{ reportInfo.patientSex == '1' ? "男" : "女" }}
        </div>
        <div><span>年龄：</span>{{ reportInfo.patientAge }}</div>
      </div>
    </div>
    <div class="insp_gip"></div>
    <div class="insp_box">
      <div class="insp_box_cell">
        <div><span>开单医生：</span>{{ reportInfo.klDoctorName }}</div>
        <div><span>开单科室：</span>{{ reportInfo.klDeptName }}</div>
<!--        <div><span>审核医生：</span>{{ reportInfo.reviewName }}</div>-->
<!--        <div><span>审核医生：</span>{{ reportInfo.reviewName }}</div>-->
      </div>
<!--      <div class="insp_box_nocell">-->
<!--        <span>报告单号：</span>{{ reportId }}-->
<!--      </div>-->

    </div>

    <div class="insp_gip"></div>
    <div class="insp_box">
      <div class="insp_box_cell">
        <div><span>执行医生：</span>{{ reportInfo.doctorName }}</div>
        <div><span>执行科室：</span>{{ reportInfo.deptName }}</div>
      </div>
      <div class="insp_box_cell">

        <!--            <div><span>审核时间：</span>{{ reportInfo.reviewTime }}</div>-->
        <div class="insp_box_nocell">
          <span>报告日期：</span>{{ reportTime }}
        </div>
        <div><span>审核医生：</span>{{ reportInfo.reviewName }}</div>
      </div>
    </div>
    <div class="insp_gip"></div>
    <div class="table_box">
      <table>
        <template v-if="(info.reportType == 0)">
          <thead>
          <tr>
            <th>项目</th>
            <th>结果</th>
            <th>单位</th>
            <th>参考值</th>
            <th>结果分析</th>
          </tr>
          </thead>

          <tbody>
          <tr v-for="(item, index) in checkList">
            <td>{{ item.checkName }}</td>
            <td>{{ item.result }}</td>
            <td>{{ item.unit }}</td>
            <td>{{ item.referenceValue }}</td>
            <td v-if="item.normalFlag!='正常'" style="color:red">{{ item.normalFlag }}</td>
            <td v-else style="color:green">{{ item.normalFlag }}</td>
          </tr>
          </tbody>
        </template>
        <template v-else>
          <thead>
          <tr>
            <th>药品名称</th>

            <th>参考值</th>

          </tr>
          </thead>

          <tbody>
          <tr v-for="(item, index) in checkList">
            <td>{{ item.checkName }}</td>
            <td>{{ item.referenceValue }}</td>
          </tr>
          </tbody>
        </template>
      </table>
    </div>
<!--    -->
<!--    <div class="insp_gip"></div>-->
<!--    <div class="insp_box">-->
<!--      <div class="insp_box_cell">-->
<!--        <div><span>申请日期：</span>{{ reportInfo.applyDate }}</div>-->
<!--        <div><span>采集日期：</span>{{ reportInfo.receiptsDate }}</div>-->
<!--      </div>-->
<!--      <div class="insp_box_cell">-->
<!--        <div><span>校验日期：</span>{{ reportInfo.checkDate }}</div>-->
<!--        <div><span>打印日期：</span>{{ reportInfo.reportDate }}</div>-->
<!--      </div>-->
<!--    </div>-->

  </div>
</template>
<script>
import {getNormalReportInfo} from "@/api/api";

export default {
  components: {},
  data() {
    return {
      reportId: '',
      reportTime: '',
      info: {},
      checkList: [],
      reportInfo: {},
    };
  },
  created() {
    if (this.$route.query) {
      this.info = this.$route.query;
      console.log(this.info);
      this.reportId = this.info.reportId;
      this.reportTime = this.info.reportTime;
      this.getNormalReportInfo(this.info.hospPatientId, this.info.reportId);
    }
  },
  methods: {
    getNormalReportInfo(hospPatientId, reportId) {
      var data = {
        hosId: "",
        hospPatientId,
        reportId,
      };
      getNormalReportInfo(data).then((res) => {
        if (res.code == 200) {
          this.checkList = res.data.checkList.detail;
          this.reportInfo = res.data.reportInfo;
        }
      });
    },
  },
};
</script>
<style scoped>
.insp_box {
  width: calc(100% - 2rem);
  padding: 1.125rem 1rem;
  font-size: 0.9375rem;
  background-color: #fff;
}

.insp_box_nocell > span {
  color: #949fb4;
  font-size: 0.875rem;
}

.insp_box_cell {
  display: flex;
  justify-content: space-between;
  /* align-items: center; */
}

.insp_box_cell > div > span {
  color: #949fb4;
  font-size: 0.875rem;
}

.insp_gip {
  width: 100%;
  height: 0.625rem;
  background: rgba(247, 250, 253, 1);
}

.insp_box_cell .name {
  font-size: 0.875rem;
  color: #949fb4;
  width: 4.375rem;
}

.insp_box_cell .msg {
  width: calc(100% - 4.375rem);
  font-size: 0.9375rem;
}

.table_box {
  width: calc(100% - 2rem);
  padding: 0.9375rem 1rem;
  font-size: 0.8125rem;
}

.table_box table {
  width: 100%;
  border-collapse: collapse;
}

.table_box td,
th {
  border: 1px solid #d6dff1;
  font-weight: normal;
  text-align: center;
  padding: 0.3125rem 0.625rem;
}

.table_box td:nth-child(odd) {
  width: 40%;
}

.table_box thead {
  background-color: #94CBFF;
  color: #fff;
}
</style>
